﻿using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using OpenAdmin.Core.DbContextLocators;

namespace OpenAdmin.Core.Models;

/// <summary>
/// 权限表
/// </summary>
[Table("SysPermission")]
public class SysPermission : EntityBase<ApplicationDbContextLocator>, IEntityTypeConfigure<SysPermission>
{
    /// <summary>
    /// 权限类型
    /// </summary>
    public string Type { get; set; }

    /// <summary>
    /// 权限名称
    /// </summary>
    public string Name { get; set; }

    public void Configure(EntityTypeBuilder<SysPermission> entityBuilder)
    {
        entityBuilder.Property(p => p.Type).HasMaxLength(50).IsRequired();
        entityBuilder.Property(p => p.Name).HasMaxLength(50).IsRequired();
    }
}
